#ifndef KEYBOARDELEMENT_H_INCLUDED
#define KEYBOARDELEMENT_H_INCLUDED

#include "ConfigElement.h"

#define KEYBOARD_TAG                        "keyboard"

#define KEYBOARD_INTERPRETER_ATTRIBUTE      "interpreter"

#define KEYMAP_TAG                          "keymap"
#define KEYMAP_KEY_ATTRIBUTE                "key"
#define KEYMAP_ACTION_ATTRIBUTE             "action"

namespace OpenNano
{
    typedef std::map<std::string, std::string> KeyMaps;

    class OPENNANO_EXPORT KeyboardElement : public ConfigElement
    {
        DECLARE_OBJECT_FACTORY( KeyboardElement );

        private:
            std::string _interpreter;
            KeyMaps _keymaps;
            bool _everything_is_good_so_far;

        protected:
            void attributeFound(TiXmlAttribute * attribute );
            void childElementFound( TiXmlElement * childElement );
            void textFound(const char * text);
            bool postConfiguration();
            void init();

        public:
            const KeyMaps& getKeyMaps() const;
            bool getKeyMap(const std::string& key, std::string &action);
            const std::string& getInterpreter() const;
    };

}

#endif // KEYBOARDELEMENT_H_INCLUDED
